/// CreateTime 2020/6/8 11:54
/// CreateUser chen 
/// ProjectName flutter_elf
import 'package:flutter_elf/config/component_index.dart';
Stream<int> timedCounter(Duration interval, [int maxCount]) async* {
  int i = 0;
  while (true) {
    await Future.delayed(interval);
    yield i++;
    if (i == maxCount) break;
  }
}

void main() async {
  timedCounter(Duration(seconds: 2), 5).listen(print);
  await Future.delayed(Duration(seconds: 1000));
}